package com.yifeng.repo.micro.service.server.mps;

import feign.Param;
import feign.RequestLine;
import next.fire.mps.api.CardService;
import next.fire.mps.api.model.Card;
import org.springframework.cloud.openfeign.FeignClient;

import java.util.Date;
import java.util.Map;

@FeignClient(name = "mpsCardServiceClient", url = "${yfcloud.micro.service.mps.url}", path = "/fire-mps")
public interface CardServiceClient extends CardService {

    @Override
    @RequestLine("POST /CardService/getUrl")
    String getUrl(@Param("merchantId") String merchantId, @Param("mpAppId") String mpAppId, @Param("cardTemplateId") String cardTemplateId,
                  @Param("appRedirectUrl") String appRedirectUrl, @Param("state") String state);

    @Override
    @RequestLine("POST /CardService/open")
    String open(@Param("merchantId")String merchantId, @Param("mpAppId")String mpAppId, @Param("openId") String openId, @Param("code") String code,
                @Param("cardTemplateId") String cardTemplateId, @Param("validDate") Date validDate, @Param("authCode") String authCode);

    @Override
    @RequestLine("POST /CardService/update")
    void update(@Param("merchantId") String merchantId, @Param("mpAppId") String mpAppId, @Param("params") Map params);

    @Override
    @RequestLine("POST /CardService/getByMpCardCode")
    Card getByMpCardCode(@Param("merchantId") String merchantId, @Param("mpAppId") String mpAppId, @Param("mpCardCode") String mpCardCode);

}
